//
//  YSGroupIntroductionCtrl.m
//  Yueshi
//
//  Created by yueshi－mac1 on 15/12/8.
//  Copyright © 2015年 悦食中国. All rights reserved.
//

#import "YSGroupIntroductionCtrl.h"
#import "YSClubDataTool.h"

@interface YSGroupIntroductionCtrl ()
@property (weak, nonatomic) IBOutlet UIImageView *avatarView;
@property (weak, nonatomic) IBOutlet UILabel *groupLeaderLabel;
@property (weak, nonatomic) IBOutlet UILabel *detailLabel;
@property (weak, nonatomic) IBOutlet UILabel *remarkLabel;

@property (strong, nonatomic) YSInterestGroup *interestGroup;

@end

@implementation YSGroupIntroductionCtrl

- (instancetype)initWithInterestGroup:(YSInterestGroup *)interestGroup{
    self = [ super init];
    if (self) {
        _interestGroup = interestGroup;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setTitle:self.interestGroup.groupName];
    
    [self.avatarView setImageURLStr:self.interestGroup.userImg];
    [self.groupLeaderLabel setText:self.interestGroup.groupLeader];
    
    [self requestData];
    
}

- (void) requestData{
    [YSClubDataTool getGroupDetailWithGroupId:self.interestGroup.groupId success:^(YSGroupDetail *result) {
        if (result.isSucc) {
            self.detailLabel.text = result.detail;
            self.remarkLabel.text = result.remark;
        }else{
            ShowTips(result.data);
        }
    } failure:^(NSError *error) {
        ShowTips(kRequestFailure);
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
